#ifndef _LIST_H
#define _LIST_H

#ifdef __cplusplus
extern "C"{
#endif //#ifdef __cplusplus

#include "common.h"

// define by user
#ifndef _ITEM_DEFINE
#define _ITEM_DEFINE

#define TSIZE 100

typedef struct{
	char key[TSIZE];
	int data;
}Item;
#endif // #ifndef _ITEM_DEFINE

//======================
typedef struct node{
	Item item;
	struct node *next;
}Node,*List;
typedef void (*Pfun)(Item item);

BOOL createList(List * plist);
BOOL isFull(const List *plist);
BOOL isEmpty(const List *plist);
int list_length(const List *plist);
BOOL addItem(List *plist,const Item item);
void traverse(const List *plist,Pfun pfun);
void destroyList(List *plist);

#ifdef __cplusplus
}
#endif //#ifdef __cplusplus

#endif // #ifndef _LIST_H

